<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>调入设备类</title>
	<link rel="stylesheet" type="text/css" href="../../../resource/css/bootstrap.css">
	<link rel="stylesheet" type="text/css" href="../../../resource/css/user_css/publicStyle.css">
	<link rel="stylesheet" type="text/css" href="../../../resource/layui/css/layui.css"/>
	<link rel="stylesheet" type="text/css" href="../../../resource/css/niubility.css"/>
	<script type="text/javascript" src="../../../resource/layui/layui.js"></script>
	<!-- 购入、调入,调出，维修维护，报损报废相同的css样式 -->
	<link rel="stylesheet" type="text/css" href="../../../resource/css/user_css/purchase_diaoRu_style.css"/>
</head>
<body>
	<form action="" method="post" id="formAddDevice">
		<div class="boxOne">
			<div class="form-group">
		      	<label>设备类别名称:</label>
			    <select  class="form-control" name="equipmentCategoryNo" id="equipmentCategory">
				  <option value="-1">---未选择---</option>
				</select>
	      	</div>
	      	<div class="form-group">
		      	<label>存放场所:</label>
			    <select  class="form-control" name="placeNo" id="place">
				  <option value="-1">---未选择---</option>
				</select>
	      	</div>
	    	<div class="form-group">
	      	  <label for="equipmentName">设备名称:</label>
	          <input type="text" class="form-control" name="equipmentName" id="equipmentName">
	    	</div>
	    	<div class="form-group">
	      	  <label for="number">数量:</label>
	          <input type="number" class="form-control" name="number" id="number" min="1" max="3" value="1"/>
	    	</div>
	    	<div class="form-group">
	      	  <label for="price">单价:</label>
	          <input type="text" class="form-control" name="price" id="price">
	    	</div>
			<div class="form-group">
				<label for="type">型号:</label>
				<input type="text" class="form-control" name="type" id="type"   placeholder="可选填"/>
			</div>

		</div>
		<div class="boxOne">
			<div class="form-group">
				<!--开始使用日期，就是为了计算折旧年限-->
				<label for="purchaseDate">开始使用日期:</label>
				<input type="date" class="form-control" name="purchaseDate" id="purchaseDate" >
			</div>
			<div class="form-group">
				<label for="guiGe">规格:</label>
				<input type="text" class="form-control" name="guiGe" id="guiGe"  placeholder="可选填"/>
			</div>
	    	<div class="form-group">
	      	  <label for="manufacturer">出产厂家:</label>
	          <input type="text" class="form-control" name="manufacturer" id="manufacturer"  placeholder="可选填"/>
	    	</div>
	    	<div class="form-group">
	      	  <label for="manufacturerNo">制造号:</label>
	          <input type="text" class="form-control" name="manufacturerNo" id="manufacturerNo"   placeholder="可选填"/>
	    	</div>
	    	<div class="form-group">
	      	  <label for="shippingNo">出货票号码:</label>
	          <input type="text" class="form-control" name="shippingNo" id="shippingNo"  placeholder="可选填"/>
	    	</div>
	    	<div class="form-group">
	      	  <label for="deliveryUnit">供货单位:</label>
	          <input type="text" class="form-control" name="deliveryUnit" id="deliveryUnit"  placeholder="可选填"/>
	    	</div>

		</div>
		<div class="boxOne">
			<div class="form-group">
				<label for="application">用途:</label>
				<input type="text" class="form-control" name="application" id="application" placeholder="可选填"/>
			</div>
	    	<div class="form-group" >
	      	   <label for="transerDate">调拨日期:</label>
	           <input type="date" class="form-control" name="transerDate" id="transerDate" >
		    </div>
			<div class="form-group">
	      	  <label for="transerOutUnit">调出单位:</label>
	          <input type="text" class="form-control" name="transerOutUnit" id="transerOutUnit">
	    	</div>
	    	<div class="form-group">
	      	  <label >调入单位:</label>
	          <input type="text" class="form-control" name="transerInUnit"  value="计算机科学学院">
	    	</div>
			<div class="form-group">
				<label for="remark">备注:</label>
				<textarea style="height: 38px;" class="form-control" name="remark" id="remark"  placeholder="可选填"></textarea>
			</div>
			<div class="form-group" >
				<label>调拨原因:</label>
				<textarea name="transerReason"  id="transerReason" class="form-control" style="width: 250px;height: 40px;"></textarea>
			</div>
		</div>
		<div class="boxOne">
			<div class="form-group">
				<label for="equipmentNo"><a title=" 如果添加多个,请以“逗号为分隔符” ">设备编号：</a> <i class="layui-icon jia" style=" font-size: 18px; color:#999999;">&#xe61f;</i></label>
				<input type="text" class="form-control" name="equipmentNo" id="equipmentNo">
				<div id="bianhao"></div>
			</div>
			<div class="form-group">
				<label for="attachmentName">附件名称:</label>
				<input type="text" class="form-control" name="attachmentName" id="attachmentName"  placeholder="可选填"/>
			</div>
			<div class="form-group">
				<label for="attachmentGuiGe">附件规格:</label>
				<input type="text" class="form-control" name="attachmentGuiGe" id="attachmentGuiGe" placeholder="可选填"/>
			</div>
			<div class="form-group">
				<label for="application">附件数量:</label>
				<input type="text" class="form-control" name="attachmentNumber" id="attachmentNumber"  placeholder="可选填"/>
			</div>
			<div class="form-group">
				<label for="leaderOfUserUnit">使用单位负责人:</label>
				<input type="text" class="form-control" name="leaderOfUserUnit" id="leaderOfUserUnit"  placeholder="可选填"/>
			</div>
			<div class="form-group">
				<label for="purchaser">采购人:</label>
				<input type="text" class="form-control" name="purchaser" id="purchaser" placeholder="可选填"/>
			</div>
		</div>
		<div class="boxOne">
			<div class="form-group">
				<label for="acceptor">验收人:</label>
				<input type="text" class="form-control" name="acceptor" id="acceptor"  placeholder="可选填"/>
			</div>
			<div class="form-group">
				<label for="bookkeeper">记账人:</label>
				<input type="text" class="form-control" name="bookkeeper" id="bookkeeper" placeholder="可选填"/>
			</div>
			<div class="form-group">
				<label>利用率模板:</label>
				<select  class="form-control" name="utilizationTemplateNo" id="utilizationTemplate">
					<option value="-1">---未选择---</option>
				</select>
			</div>
		</div>
		<div style="clear: both;"></div>
	    <button type="button" class="btn btn-default" id="btn">提交</button>
	</form>

	<script type="text/javascript" src="../../../resource/js/jquery.min.js"></script>

	<!-- 静态url路径 -->
	<script type="text/javascript" src="../../../resource/js/static_url.js"></script>
	<!--表单验证：购入、调入 公共部分-->
	<script type="text/javascript" src="../../../resource/js/user_js/User_form_verification.js"></script>
	<!-- 表单序列化提交：购入、调入、调出、维修维护、报损报废、转让 -->
	<script type="text/javascript" src="../../../resource/js/user_js/user_post_serialize.js"></script>
	<!-- 设备类别名、存放场所 js  -->
	<script type="text/javascript" src="../../../resource/js/user_js/gouRuDiaoRu.js"></script>

	<!--表单验证-->
	<script type="text/javascript">
        $("#btn").click(function(){

/*------------------------------***必填： 调入单独的一部分***----------------------------------*/
            // 调拨日期 -----不能为空，超出当前时间也不行
            var evalue = $("#transerDate").val();
            if(evalue == ''){
                layui.use('layer', function(){
                    var layer = layui.layer;
                    layer.tips('亲，请填写调拨日期', '#transerDate', {
                        tips: [1, '#333'],
                        time: 2500,
                    });
                });
                return;
			}
            var dB = new Date(evalue.replace(/-/g, "/"));//获取当前选择日期
            var d = new Date();
            var str = d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();//获取当前实际日期
            if (Date.parse(str) < Date.parse(dB)) {//时间戳对比---距离1970/1/1的毫秒数
                layui.use('layer', function(){
                    var layer = layui.layer;
                    layer.tips('您，选中的时间 大于 当前时间', '#transerDate', {
                        tips: [1, '#333'],
                        time: 2500,
                    });
                });
                return ;
            }

            //调出单位
			var transerOutUnit = $("#transerOutUnit").val();
            if(transerOutUnit==''){
                layui.use('layer', function(){
                    var layer = layui.layer;
                    layer.tips('亲，请填写调出单位', '#transerOutUnit', {
                        tips: [1, '#333'],
                        time: 2500,
                    });
                });
                return;
            }
            /*---------------------------------选填字段： 长度不超过 25 就行--------------------------------*/
            var transerReason = $("#transerReason").val(); // 调拨原因
            if(transerReason.length>150){
                layui.use('layer', function(){
                    var layer = layui.layer;
                    layer.tips('亲,调拨原因字符长度必须小于150个字符', '#transerReason', {
                        tips: [1, '#333'],
                        time: 2500,
                    });
                });
                return;
            }

            // ------表单验证函数： 购入 和 调入 共同部分----------
            check_submit_form(user_diaoru_post);
        });




        $("#equipmentNo").focus(function(){
            layui.use("layer",function(){
                layer.tips('输入设备编号后，请点击加号添加！如有多个设备编号，请以逗号分隔开', '#equipmentNo', {
                    tips: [2, '#333333'],
                    time: 4000
                });
			});
		})

		// 设置默认时间
		var myDate = new Date();
		var year = myDate.getFullYear();
		var month = myDate.getMonth()+1;
		var day = myDate.getDate();
		//判断 月份、天数 <10的时候前面加 0
		if(month < 10){
			month = "0"+month;
		}
		if(day < 10){
			day = "0"+day;
		}
		var time = year +"-"+ month +"-"+ day;
		$("#purchaseDate").val(time);
		$("#transerDate").val(time);
	</script>
</body>
</html>